package com.client;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class ClientProtocolCodecFactory implements ProtocolCodecFactory {

  private final ClientProtocolEncoder encoder;

  private final ClientProtocolDecoder decoder;

  public ClientProtocolCodecFactory(Charset charset) {
    this.encoder=new ClientProtocolEncoder(charset);
    this.decoder=new ClientProtocolDecoder(charset);
  }

  public ProtocolDecoder getDecoder(IoSession arg0) throws Exception {
    return decoder;
  }

  public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
    return encoder;
  }
}
